<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>重置密码</title>
<script  type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-3.1.1.min.js"></script>
<link rel="stylesheet" href="/bsc/js/common/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/bsc/js/common/bootstrap/css/bootstrap-theme.min.css">
<script src="/bsc/js/common/bootstrap/js/bootstrap.min.js"></script>
</head>
<script type="text/javascript">
var code;
	$(function(){
		$("#btn1").click(function() {
			var phone = $("#mobile").val();
			if(phone.length!=11){
				alert("请输入正确的电话号码，长度为11位");
				return;
			}
			var bool = true;
			var count = 60;
			if (bool) {
				var p = setInterval(function() {
					count--;
					if (count == 0) {
						clearInterval(p);
						$("#btn1").prop("disabled", false);
						$("#btn1").val("重新发送");
						bool = true;
					} else {
						$("#btn1").prop("disabled", true);
						$("#btn1").val("还剩" + count + "秒");
						bool = false;
					}
				}, 1000);
			}
			//获取验证码
				$.ajax({
					type:"post",
					url:"${pageContext.request.contextPath }/proltal/zn1/getcode",
					data:{"mobile":$("#mobile").val()},
					success:function(msg){
						alert(msg);
						code=msg;
					}
				});
			});
		
		$("#btn2").click(function() {
			var code1=$("#yanzhengma").val();
			if(code!=code1){
				alert("验证码不正确");
				return;
			}
			form.action="${pageContext.request.contextPath }/proltal/zn1/resetPassword";
			form.submit();
		})
	})
</script>
<body>
	<form method="post" id="form">
		请输入手机号码：<input type="text" name="mobile" id="mobile"/>
		<input type="button" id="btn1" value="发送短信验证"><br>
		请输入验证码:<input type="text" id="yanzhengma" name="yanzhengma"><br>
		<input type="button" id="btn2" value="确定"/>
	</form>
</body>
</html>